package com.zjw.zy.heart.utils;


import com.google.gson.Gson;
import lombok.NonNull;

import java.lang.reflect.Type;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/9/26 17:29
 */
public final class GsonUtils {

    private static final Gson sGson = new Gson();


    public static String toJson(Object object) {
        return sGson.toJson(object);
    }


    public static <T> T fromJson(@NonNull String json, @NonNull Class<T> clazz) {
        return sGson.fromJson(json, clazz);
    }

    public static <T> T fromJson(@NonNull String json, @NonNull Type type) {
        return sGson.fromJson(json, type);
    }
}
